{
  "properties" : { },
  "id" : "efbb995e16354b258f38e288c4e1d130",
  "script" : null,
  "groupId" : "c0cf605f74e34bc6953194a869f4a6cd",
  "name" : "C查询地区天气预报",
  "createTime" : 1732780546966,
  "updateTime" : 1724310239256,
  "lock" : null,
  "createBy" : "admin",
  "updateBy" : "admin",
  "path" : "/regionweatherfc",
  "method" : "GET",
  "parameters" : [ {
    "name" : "regioncode",
    "value" : null,
    "description" : "行政区划编码 等于",
    "required" : false,
    "dataType" : "String",
    "type" : null,
    "defaultValue" : null,
    "validateType" : null,
    "error" : null,
    "expression" : null,
    "children" : null
  }, {
    "name" : "stationkey",
    "value" : "54287",
    "description" : "站点ID",
    "required" : false,
    "dataType" : "String",
    "type" : null,
    "defaultValue" : null,
    "validateType" : null,
    "error" : null,
    "expression" : null,
    "children" : null
  }, {
    "name" : "validtime",
    "value" : "6",
    "description" : "查询多少小时范围内预报 （ 168 )以内",
    "required" : false,
    "dataType" : "String",
    "type" : null,
    "defaultValue" : null,
    "validateType" : null,
    "error" : null,
    "expression" : null,
    "children" : null
  } ],
  "options" : [ ],
  "requestBody" : "",
  "headers" : [ ],
  "paths" : [ ],
  "responseBody" : "{\n    \"code\": 1,\n    \"message\": \"success\",\n    \"data\": [\n        {\n            \"stationKey\": \"54287\",\n            \"lat\": 42,\n            \"lon\": 128.1,\n            \"high\": 2623.9,\n            \"city\": \"\",\n            \"stationName\": \"\",\n            \"timeBase\": \"2024-08-19T08:00:00\",\n            \"validtime_max\": 168,\n            \"validtime\": 3,\n            \"temp\": 14.3,\n            \"pres\": 857.6,\n            \"cov_low\": 0,\n            \"cov_all\": 33.2,\n            \"win_dir\": 262.2,\n            \"win_vel\": 4.2,\n            \"humi\": 92.2,\n            \"prec\": 1.2,\n            \"wep\": 7,\n            \"code\": \"226102\",\n            \"fctime\": \"2024-08-19T11:00:00\"\n        },\n        {\n            \"stationKey\": \"54287\",\n            \"lat\": 42,\n            \"lon\": 128.1,\n            \"high\": 2623.9,\n            \"city\": \"\",\n            \"stationName\": \"\",\n            \"timeBase\": \"2024-08-19T08:00:00\",\n            \"validtime_max\": 168,\n            \"validtime\": 6,\n            \"temp\": 14.9,\n            \"pres\": 857.2,\n            \"cov_low\": 0,\n            \"cov_all\": 46.1,\n            \"win_dir\": 257.3,\n            \"win_vel\": 3.2,\n            \"humi\": 91.5,\n            \"prec\": 2.5,\n            \"wep\": 7,\n            \"code\": \"226102\",\n            \"fctime\": \"2024-08-19T14:00:00\"\n        }\n    ],\n    \"timestamp\": 1724310079356,\n    \"executeTime\": 91\n}",
  "description" : null,
  "requestBodyDefinition" : null,
  "responseBodyDefinition" : null
}
================================
var sql = """
    select t1.*,DATE_ADD(t1.timeBase, INTERVAL t1.validtime HOUR) fctime from wefcdata t1  
    join( select stationKey ,max(timeBase) as latest_timestamp 
    from wefcdata
    where 1 = 1 
    <if test="regioncode != null and regioncode != ''" > and code LIKE CONCAT(#{regioncode},'%') </if>
    <if test="stationkey != null and stationkey != ''\" > and stationkey = #{stationkey} </if>
  
    group by stationKey
    )  t2 on t1.stationKey = t2.stationKey and t1.timeBase = t2.latest_timestamp
           <if test="validtime != null and validtime != ''\" > and validtime <= #{validtime} </if>
      order by code 
"""
return db.select (sql);